<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>敏感词过滤</title>
	<meta name="description" content="">
	<meta name="keywords" content="">
	<link href="" rel="stylesheet">
	<script>
		window.onload=function (argument) {
			var txt1 = document.getElementById('txt1');
			var btn = document.getElementById('btn');
			var txt2 = document.getElementById('txt2');

			btn.onclick=function(){
				var re = /国明|反腐/g;

				txt2.value=txt1.value.replace(re,'*');
			}
		}
	</script>
</head>
<body>
    <textarea name="" id="txt1" cols="30" rows="10"></textarea><br/>
    <input type="button" id="btn" value="过滤"><br/>
    <textarea name="" id="txt2" cols="30" rows="10"></textarea><br/>
</body>
</html>